from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

# xpath 标签索引
# //form/input
ipt = driver.find_element(By.XPATH, '//form/input[3]')  #定位到的是第一个匹配的input
print(ipt.get_attribute('outerHTML'))

ipts = driver.find_elements(By.XPATH, '//form/input')
for i in ipts:
    print(i.get_attribute('outerHTML'))

driver.quit()